#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 100
typedef int DataType;
typedef struct stacknode //链栈的定义
{
	DataType data;
	struct stacknode* next;

}LinkStack;
LinkStack* InitStack() //初始化
{
	LinkStack* S;
	S = NULL;
	return S;
}
int EmptyStack(LinkStack* S) //判断空栈
{
	if (S == NULL)
		return 1;
	else
		return 0;
}
LinkStack* Push(LinkStack* S, DataType x) //进栈
{
	LinkStack* p;
	p = (LinkStack*)malloc(sizeof(LinkStack));
	p->data = x;
	p->next = S;
	S = p;
	return S;
}
LinkStack* Pop(LinkStack* S, DataType* x)
{
	LinkStack* p;
	if (EmptyStack(S))
		return NULL;
	else
	{
		*x = S->data;
		p = S;
		S = S->next;
		free(p);
		return S;
	}
}
int GetTop(LinkStack* S, DataType* x)
{
	if (EmptyStack(S))
	{
		printf("栈空");
	}
	else
	{
		*x = S->data;
		return 1;
	}
}
void ShowStack(LinkStack* S)
{
	LinkStack* p = S;
	if (p == NULL)
	{
		printf("栈空");

	}
	else
	{
		while (p != NULL)
		{
			printf("%d", p->data);
			p = p->next;
		}
	 }
 }
int main()
{
	LinkStack* S = InitStack();
	int i = 0;
	int n = 0;
	for (i = 0; i < 5; i++)
	{
		scanf("%d", &n);
		Push(S, n);
	}
	S = Pop(S, &n-1);
	printf("%d %d %d %d %d", n-1,n-2,n,n-3,n-4);
	return 0;




}